
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:xim/config/route_config.dart';
import 'package:xim/http/apis/user/user_model.dart';
import 'package:xim/widget/common/state.dart';
import 'package:xim/common/get_style_view.dart';
class NewFriendStyle extends Style with AppBarMixin {

  /// 输入框
  final FocusNode _searchFocusNode = FocusNode();

  @override
  String get appBarTitle => "新的朋友";

  @override
  Color get appBarBgColor => bgColor.color;

  @override
  TextStyle get appBarTitleStyle => TextStyle(color: bgColor.reverse, fontSize: 14);

  Widget userRowItem(UserFriendModel userInfo, String selfAccount){
    return GestureDetector(
      onTap: ()=> Routers.toProfilePublicPage(userInfo.friendUserInfo.account),
      child: Container(
        padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 12),
        color: weakBgColor.color,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Row(
              children: [
                ClipRRect(
                    borderRadius: const BorderRadius.all(Radius.circular(8)),
                    child: Image.network(
                      userInfo.friendUserInfo.avatar,
                      width: 50,
                    )
                ),
                const SizedBox(width: 16,),
                Column(
                  children: [
                    Text(
                        userInfo.friendUserInfo.name,
                        style: TextStyle(color: textColor.color, fontSize: 16)
                    ),
                    if(userInfo.applyNote!=null) Text(
                        userInfo.applyNote!,
                        style: TextStyle(color: textColor.color)
                    ),
                  ],
                ),
              ],
            ),
            userInfo.creatorAccount==selfAccount ? Text(
              userInfo.status==1 ? '已添加' : '已发出',
              style: TextStyle(color: textColor.color, fontSize: 14),
            ) : Text(
              userInfo.status==1 ? '已同意' : '同意',
              style: TextStyle(color: textColor.color, fontSize: 14),
            )
          ],
        ),
      ),
    );
  }

}